<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<meta name="renderer" content="webkit">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
		<link rel="stylesheet" href="../../layuiadmin/layui/css/layui.css" media="all">
		<link rel="stylesheet" href="../../layuiadmin/style/admin.css" media="all">
		<link rel="stylesheet" href="../../css/common.css" media="all">
	</head>
	<body>

		<div class="layui-fluid">
			<div class="layui-row layui-col-space15">
				
				<div class="layui-col-md3">
					<div class="layui-card">
						<div class="layui-card-header">今日统计</div>
						<div class="layui-card-body">

							<div class="layui-carousel layadmin-carousel layadmin-backlog">
								<div>
									<ul class="layui-row layui-col-space10">
										<li class="layui-col-xs12">
											<a href="javascript:;" class="layadmin-backlog-body">
												<h3>今日交易成功数量</h3>
												<p><cite class="today_trans_count">0</cite></p>
											</a>
										</li>
										<li class="layui-col-xs12">
											<a href="javascript:;" class="layadmin-backlog-body">
												<h3>今日交易成功金额</h3>
												<p><cite class="today_trans_sum">￥0.00</cite></p>
											</a>
										</li>
									</ul>
								</div>
							</div>
						</div>
					</div>
				</div>
				<div class="layui-col-md3">
					<div class="layui-card">
						<div class="layui-card-header">昨日统计</div>
						<div class="layui-card-body">

							<div class="layui-carousel layadmin-carousel layadmin-backlog">
								<div>
									<ul class="layui-row layui-col-space10">
										<li class="layui-col-xs12">
											<a href="javascript:;" class="layadmin-backlog-body">
												<h3>昨日交易成功数量</h3>
												<p><cite class="yes_today_trans_count">0</cite></p>
											</a>
										</li>
										<li class="layui-col-xs12">
											<a href="javascript:;" class="layadmin-backlog-body">
												<h3>昨日交易成功金额</h3>
												<p><cite class="yes_today_trans_sum">￥0.00</cite></p>
											</a>
										</li>
									</ul>
								</div>
							</div>
						</div>
					</div>
				</div>
				<div class="layui-col-md3">
					<div class="layui-card">
						<div class="layui-card-header">本月统计</div>
						<div class="layui-card-body">

							<div class="layui-carousel layadmin-carousel layadmin-backlog">
								<div>
									<ul class="layui-row layui-col-space10">
										<li class="layui-col-xs12">
											<a href="javascript:;" class="layadmin-backlog-body">
												<h3>本月交易成功数量</h3>
												<p><cite style="color: #FF5722;" class="month_trans_count">0</cite></p>
											</a>
										</li>
										<li class="layui-col-xs12">
											<a href="javascript:;" class="layadmin-backlog-body">
												<h3>本月交易成功金额</h3>
												<p><cite style="color: #FF5722;" class="month_trans_sum">￥0.00</cite></p>
											</a>
										</li>
									</ul>
								</div>
							</div>
						</div>
					</div>
				</div>
				<div class="layui-col-md3">
					<div class="layui-card">
						<div class="layui-card-header">上月统计</div>
						<div class="layui-card-body">
							<div class="layui-carousel layadmin-carousel layadmin-backlog">
								<div>
									<ul class="layui-row layui-col-space10">
										<li class="layui-col-xs12">
											<a href="javascript:;" class="layadmin-backlog-body">
												<h3>上月交易成功数量</h3>
												<p><cite style="color: #5FB878;" class="prev_month_trans_count">0</cite></p>
											</a>
										</li>
										<li class="layui-col-xs12">
											<a href="javascript:;" class="layadmin-backlog-body">
												<h3>上月交易成功金额</h3>
												<p><cite style="color: #5FB878;" class="prev_month_trans_sum">￥0.00</cite></p>
											</a>
										</li>
									</ul>
								</div>
							</div>
						</div>
					</div>
				</div>
				
				<div class="layui-col-md12">
					<!-- <div class="layui-card">
						<div class="layui-card-header">数据概览</div>
						<div class="layui-card-body">

							<div class="layui-carousel layadmin-carousel layadmin-dataview" data-anim="fade" lay-filter="LAY-index-dataview">
								<div carousel-item id="LAY-index-dataview">
									<div><i class="layui-icon layui-icon-loading1 layadmin-loading"></i></div>
									<div></div>
									<div></div>
								</div>
							</div>

						</div>
					</div> -->
					<div class="layui-card">
						<div class="layui-tab layui-tab-brief layadmin-latestData">
							<ul class="layui-tab-title">
								<li class="layui-this">待发货订单</li>
								<li><!--最近7天新增商户--></li>
							</ul>
							<div class="layui-tab-content">
								<div class="layui-tab-item layui-show">
									<table id="LAY-index-topSearch"></table>
								</div>
								<div class="layui-tab-item">
									<table id="LAY-index-topCard"></table>
								</div>
							</div>
						</div>
					</div>
				</div>
			
			</div>
		</div> 
		<script src="../../layuiadmin/layui/layui.js?t=1"></script>
		<script src="../../js/common.js"></script>
		<script>
			layui.config({
				base: '../../layuiadmin/' //静态资源所在路径
			}).extend({
				index: 'lib/index' //主入口模块
			}).use(['index', 'table', 'form', 'element', 'laytpl'], function() {
				var table = layui.table,
					$ = layui.$,
					form = layui.form,
					laytpl = layui.laytpl,
					element = layui.element,
					admin = layui.admin;

				var role_id = cookie.GetCookie('role_id');
				var _data = {}
				if(role_id!='2c9280826a456cb5016a45afd0430018'){
					initdata();
				}

				function initdata() {
					$.get(server.queryindex, {}, function(res, status) {
						if (status == 'success') {
							if (res.code == 0) {
								var data = res;

								// $('#loginuser').html(data.name)
								
								$('.today_trans_count').html(res.today_trans_count.data.count?res.today_trans_count.data.count:'0')
								$('.yes_today_trans_count').html(res.yes_today_trans_count.data.count?res.yes_today_trans_count.data.count:'0')
								$('.month_trans_count').html(res.month_trans_count.data.count?res.month_trans_count.data.count:'0')
								$('.prev_month_trans_count').html(res.prev_month_trans_count.data.count?res.prev_month_trans_count.data.count:'0')
								
								
								
								$('.today_trans_sum').html(res.today_trans_count.data.pay_price ? '￥'+res.today_trans_count.data.pay_price : '￥0.00')
								$('.yes_today_trans_sum').html(res.yes_today_trans_count.data.pay_price ? '￥'+res.yes_today_trans_count.data.pay_price : '￥0.00')
								$('.month_trans_sum').html(res.month_trans_count.data.pay_price ? '￥'+res.month_trans_count.data.pay_price : '￥0.00')
								$('.prev_month_trans_sum').html(res.prev_month_trans_count.data.pay_price ? '￥'+res.prev_month_trans_count.data.pay_price : '￥0.00') 
//								element.init();
								
								
								//今日待发货订单
								table.render({
									elem: '#LAY-index-topSearch',
									page: true,
									data: res.ls_orders.data,
									cols: [
										[{
										field: 'orderid',
										width: 120,
										title: '订单编号'
									}, {
										field: 'memberid',
										width: 100,
										title: '会员ID',
										sort: true
									},{
										field: 'userid',
										width: 100,
										title: '用户ID',
										sort: true
									},  {
										field: 'pay_price',
										width: 120,
										title: '支付金额',
										totalRow: true
									}, {
										field: 'quantity',
										width: 120,
										title: '商品数量',
										totalRow: true
									}, {
										field: 'consignee',
										title: '收货人',
									}, {
										field: 'mobile',
										title: '联系电话',
									}, {
										field: 'areaname',
										title: '收货地址',
										templet: function(d) {
											return d.areaname?d.areaname:'' + d.address?d.address:''
										}
									}, {
										field: 'notes',
										width: 120,
										title: '用户备注',
									}, {
										field: 'addtime',
										width: 160,
										title: '下单时间'
									}, ]
									],
									parseData: function(res) { //将原始数据解析成 table 组件所规定的数据
										return {
											"code": res.code, //解析接口状态
											"msg": res.msg, //解析提示文本
											"count": res.orders.pager.total, //解析数据长度
											"data": res.orders.data //解析数据列表
										};
									}
								});
								
//								//最近7天新增商户
//								table.render({
//									elem: '#LAY-index-topCard',
//									data: res.week_merchant_list.data,
//									page: true,
//									cols: [
//										[{
//											field: 'name',
//											title: '商户名称',
//										}, {
//											field: 'mobile',
//											title: '联系电话',
//										}, {
//											field: 'pos_sn',
//											title: 'SN号',
//										}, {
//											field: 'product',
//											title: '产品类型',
//										}, {
//											field: 'addtime',
//											title: '创建时间',
//											sort: true
//										}]
//									],
//									parseData: function(res) { //将原始数据解析成 table 组件所规定的数据
//										return {
//											"code": res.code, //解析接口状态
//											"msg": res.msg, //解析提示文本
//											"count": res.week_merchant_list.pager.total, //解析数据长度
//											"data": res.week_merchant_list.data //解析数据列表
//										};
//									}
//								});
								
							} else {
								layer.msg(res.msg);
							}
							closeloading();
						} else {
							layer.msg('服务器连接错误');
						}
					});
				}
				
			});
		</script>
	</body>
</html>
